<template>
  <el-container>
    <el-main class="nopadding">
      <scTable
        ref="mytable"
        :data="listData"
        :attrList="attrList"
        :valueList="valueList"
        :queryList="queryList"
        :parentChild="true"
        style="width: 100%; margin-bottom: 20px"
        row-key="id"
        key="id"
        stripe
        default-expand-all
        hideDo
        hidePagination
      >
        <el-table-column type="selection" width="50"></el-table-column>
        <el-table-column label="Name" prop="Name" width="180"></el-table-column>
        <el-table-column label="id" prop="id" width="150"></el-table-column>
        <el-table-column
          label="ParentId"
          prop="parentId"
          width="150"
        ></el-table-column>

        <el-table-column label="Type" prop="Type" width="150"></el-table-column>
        <el-table-column label="Obj" prop="Obj" width="180"></el-table-column>
        <!-- <el-table-column label="操作" fixed="right" align="right" width="80">
          <template #default="scope">
            <el-button
              text
              type="primary"
              size="small"
              @click="opEdit(scope.row, scope.$index)"
              >编辑</el-button
            >
          </template>
        </el-table-column> -->
      </scTable>
    </el-main>
  </el-container>
  <save-dialog
    v-if="dialogSave"
    ref="saveDialog"
    @success="handleSaveSuccess"
    @closed="dialogSave = false"
  ></save-dialog>
</template>

<script>
import saveDialog from "./save";

export default {
  name: "settingMenu",
  components: {
    saveDialog,
  },
  data() {
    return {
      dialogSave: false,
      attrList: {
        Name: "Purview",
        UseDistinct: false,
        UseBackUp: false,
        UseGroup: false,
      },
      valueList: {
        Id: "id",
        Name: "Name",
        ParentId: "parentId",
        Type: "Type",
        Obj: "Obj",
      },
      queryList: {
        State: "1",
      },
      listData: [],
    };
  },
  mounted() {
    this.opBindData();
  },
  methods: {
    //添加
    opAdd() {
      this.dialogSave = true;
      this.$nextTick(() => {
        this.$refs.saveDialog.open();
      });
    },
    //编辑
    opEdit(row) {
      this.dialogSave = true;
      this.$nextTick(() => {
        this.$refs.saveDialog.open("edit").setData(row);
      });
    },
    //编辑
    opBatchEdit() {
      this.$router.push({
        path: "/menu/batch",
      });
    },
    async opBindData() {
      // eslint-disable-next-line no-debugger
      ////debugger;
      this.$refs.mytable.clearSort();
      this.$refs.mytable.getData();
    },
  },
};
</script>

<style scoped></style>
